
'''
配置pygal的样式测试
'''

import requests 
import os,pygal
from pygal.style import LightColorizedStyle as LCS,LightenStyle as LS,Style

rootUrl = os.path.dirname(__file__)
saveUrl = os.path.join(rootUrl,"python_star.svg")

custom_style = Style(
  background='transparent',
  plot_background='transparent',
  foreground='#ff0000', #影响x,y轴两个方向的标签颜色
  foreground_strong='#ffff00', #前景色 
  foreground_subtle='#00ff00',
  opacity='.6',
  opacity_hover='.9',
  transition='100ms ease-in',  
  value_label_font_size = '50',
  tooltip_font_size = 20, #鼠标提示字体大小
  title_font_size = 18, 
  label_font_size = 24, #设置标签字体大小
  colors=('#ff0000', '#00ff00', '#0000ff'))


#更多样式参数 参考 http://www.pygal.org/en/stable/documentation/custom_styles.html#using-style-class

chart = pygal.Bar(style=custom_style)
chart.title = "测试"
chart.x_labels = u'αβγδ'
chart.add('line 1', [5, 15, 10, 8])
chart.add('line 2', [15, 20, 8, 11])
chart.add('line 3', [10, 8, 12, 12])


chart.render_to_file(saveUrl)

